package com.spring.xmlbean;

import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.spring.bean.BasicBean;
import com.spring.bean.StudentBean;

public class BeanReader {
	public static void main(String[] args) {
		BeanFactory beanfactory = new ClassPathXmlApplicationContext(
				"context.xml");
		BasicBean bean = (BasicBean) beanfactory.getBean("ioC");
		System.out.println(bean.getMessage());
		
		BasicBean cBean = (BasicBean) beanfactory.getBean("constructorInjection"); 
		System.out.println(cBean.getMessage());
		
		BasicBean referenceBean = (BasicBean) beanfactory.getBean("referenceInjection"); 
		System.out.println(referenceBean.getMessage());
		
		StudentBean student = (StudentBean) beanfactory.getBean("student1");
		System.out.println(student);
		
		// IdRef Injection
		StudentBean idRefStudent=(StudentBean)beanfactory.getBean("idReference");
		System.out.println("idreference :"+idRefStudent);
		
		//Refereence Bean
		StudentBean referencebean = (StudentBean)  beanfactory.getBean("refBean");
		System.out.println("ReferenceBean:"+referencebean );;
	}
}